package com.bancofiap.indices;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

public class IndicesFinanceiros {
	
	/*
	 * Busca taxas de CPMF de uma planilha no formato XLS
	 */
	public Double[] buscaTaxaCPMFAno() {
		
		Double[] listaJuros = new Double[13];
		HSSFWorkbook workbook;
		
		try {

			workbook = new HSSFWorkbook(new FileInputStream("C:\\wd\\fiap\\teste\\OlaMundoExcel\\planilha\\OperacoesBancoFIAP.xls"));
			HSSFSheet sheet = workbook.getSheet("IndiceFinanceiro");
			
			for (short m=1; m <13; m++) {
				HSSFRow row = sheet.getRow(4);
				HSSFCell cell = row.getCell((short)m);
				double valor = cell.getNumericCellValue();
				listaJuros[m] = valor;
				System.out.println(valor);				
			}
			
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return listaJuros;
	}

}
